﻿<UserControl xmlns:ParseControls="clr-namespace:ParseControls;assembly=ParseControls"  x:Class="ParseOnlineAdmin.ParseItemsListView"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:local="clr-namespace:ParseOnlineAdmin"
			 mc:Ignorable="d" d:DesignHeight="90" d:DesignWidth="300">
	
	<UserControl.Resources>

		<local:CountVisibilityConverter x:Key="cvc" />
		<local:IEnumerableVisibilityConverter x:Key="ivc" />
		<local:ObjectNullVisibilityConverter x:Key="onvc" />
		<local:ParseObjectToStringConverter x:Key="valueConverter" />

		<SolidColorBrush x:Key="transp" Color="Transparent"  Opacity="0" />
		<SolidColorBrush x:Key="snow" Color="Transparent" Opacity="0.0001" />
		<SolidColorBrush  x:Key="light"  Color="White" Opacity="0.35" />
		<SolidColorBrush x:Key="over" Color="White"  Opacity="0.50" />
		<SolidColorBrush x:Key="selected"  Color="White"  Opacity="0.75" />
		<LinearGradientBrush x:Key="_redBrush" StartPoint="0,0" EndPoint="1,0">
			<GradientStop Color="#E32224" Offset="0.0" />
			<!--<GradientStop Color="Transparent" Offset="0.4" />
		<GradientStop Color="Transparent" Offset="0.5" />
		<GradientStop Color="Transparent" Offset="0.6" />-->
			<GradientStop Color="#AC1417" Offset="1" />
		</LinearGradientBrush>

		<!-- Shadow -->
		<DropShadowEffect x:Key="shadow" BlurRadius="9" 
					  ShadowDepth="3" Color="#cccccc" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowWhite" BlurRadius="5" 
					  ShadowDepth="1" Color="#cccccc" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowLight" BlurRadius="5" 
					  ShadowDepth="1" Color="#f3f3f3" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowDark" BlurRadius="8" 
					  ShadowDepth="3" Color="#777777" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="navigShadow" BlurRadius="5" ShadowDepth="2" 
					  Color="#777" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowMin" BlurRadius="3" 
					  ShadowDepth="1" Color="#555" 
				Direction="270" RenderingBias="Performance" />

		
		<!-- FocusVisual -->
		<Style x:Key="SimpleFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Border
						BorderBrush="Transparent"
						BorderThickness="0"
						SnapsToDevicePixels="true" >
							<!--
							<Border.Effect>
							<DropShadowEffect ShadowDepth="0"
							Color="Gray"
							BlurRadius="5" />
							</Border.Effect>
						-->
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="listboxitem" TargetType="ListBoxItem">
			<Setter Property="Opacity" Value="0" />
			<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
			<Setter Property="RenderTransform">
				<Setter.Value>
					<TranslateTransform Y="-10" />
				</Setter.Value>
			</Setter>
			<Setter Property="FocusVisualStyle" Value="{StaticResource SimpleFocusVisual}" />
			<Setter Property="BorderBrush" Value="#ccc" />
			<Setter Property="SnapsToDevicePixels"  Value="True" />
			<Setter Property="BorderThickness" Value="1,1,1,1" />
			<Setter Property="Foreground" Value="#333" />
			<Setter Property="Background" Value="#fff" />
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="HorizontalAlignment" Value="Stretch" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">

							<Border x:Name="brdBg" SnapsToDevicePixels="true"
									   BorderBrush="#ddd" BorderThickness="1" />

							<ContentPresenter Margin="0" HorizontalAlignment="Stretch" 
								Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
								SnapsToDevicePixels="true" />
						</Grid>
						<ControlTemplate.Triggers>
							<EventTrigger RoutedEvent="Loaded">
								<BeginStoryboard>
									<Storyboard Storyboard.DesiredFrameRate="30">
										<DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
												Duration="0:0:0.7" From="0"
													Storyboard.TargetProperty="Opacity" To="1" />
										<DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
													Duration="0:0:0.7" From="-10"
														Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" To="0" />
									</Storyboard>
								</BeginStoryboard>
							</EventTrigger>
							<Trigger Property="IsSelected" Value="True">
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Background" TargetName="brdBg" Value="#ddd" />
								<Setter Property="TextBlock.Foreground" Value="#fff" />
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="False" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Background" TargetName="brdBg" Value="#ccc" />
							</MultiTrigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="True" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Background" TargetName="brdBg" Value="#aaa" />
							</MultiTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="listbox" TargetType="{x:Type ListBox}">
			<Setter Property="BorderThickness"  Value="0" />
			<Setter Property="Margin" Value="0" />
			<Setter Property="SnapsToDevicePixels" Value="True" />
			<Setter Property="Padding" Value="0" />
			<Setter Property="Background"  Value="Transparent" />
		</Style>

		<!--x:Key="{x:Type ListView}"-->
		<Style x:Key="viewListView" TargetType="ListView">
			<Setter Property="BorderThickness"  Value="0" />
			<Setter Property="Margin" Value="0" />
			<Setter Property="SnapsToDevicePixels" Value="True" />
			<Setter Property="Padding" Value="0" />
			<Setter Property="Background"  Value="Transparent" />
			<Setter Property="SnapsToDevicePixels" Value="true" />
			<Setter Property="OverridesDefaultStyle" Value="true" />
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
			<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
			<Setter Property="VerticalContentAlignment" Value="Center" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListView">
						<ParseControls:FwScrollViewer FocusVisualStyle="{StaticResource SimpleFocusVisual}" Margin="0" Padding="0">
							<ItemsPresenter x:Name="itemsPresenterListView" Margin="0" />
							</ParseControls:FwScrollViewer>
						<ControlTemplate.Triggers>
							<Trigger Property="IsGrouping" Value="true">
								<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		
		<Style x:Key="textbox" TargetType="{x:Type TextBox}">
			<Setter Property="Background" Value="{StaticResource light}" />
			<Setter Property="BorderThickness" Value="0" />
			<Setter Property="Padding" Value="3" />
			<Style.Triggers>
				<Trigger Property="IsMouseOver" Value="true">
					<Setter Property="Background" Value="{StaticResource over}" />
					<Setter  Property="BorderThickness"  Value="0" />
				</Trigger>
				<Trigger  Property="IsFocused" Value="true">
					<Setter  Property="Background" Value="{StaticResource selected}" />
					<Setter  Property="BorderThickness" Value="0" />
				</Trigger>
			</Style.Triggers>
		</Style>
		
	</UserControl.Resources>
	
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>
		
		<ListView x:Name="listview" Grid.Row="0" SnapsToDevicePixels="true" 
				  ItemContainerStyle="{StaticResource listboxitem}"
					 Style="{StaticResource viewListView}"
						ItemsSource="{Binding Path=Items, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
									ScrollViewer.HorizontalScrollBarVisibility="Disabled"
									ScrollViewer.VerticalScrollBarVisibility="Auto"
									SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
				   Effect="{StaticResource shadowDark}"  >
			<ListView.ItemTemplate>
				<DataTemplate>
					<Grid SnapsToDevicePixels="true"  >
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>

						<Rectangle Fill="#FFffffff" Opacity="0.75" Grid.ColumnSpan="2"  />

						<Border Grid.Column="0" SnapsToDevicePixels="True"
								BorderThickness="0,0,1,0" Background="#ff333333">
							<Border.BorderBrush>
								<VisualBrush>
									<VisualBrush.Visual>
										<Rectangle Stroke="#ffdddddd" StrokeDashArray="2 1" StrokeThickness="1"
											Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
											Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
									</VisualBrush.Visual>
								</VisualBrush>
							</Border.BorderBrush>
						</Border>
						
						<!--<Border SnapsToDevicePixels="true" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />

						<Border SnapsToDevicePixels="true" Margin="0,0,3,0" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />-->

						<ParseControls:FwCheckBox Width="30" Height="30"  SnapsToDevicePixels="true" Margin="8,3,0,3"
							VerticalContentAlignment="Center" HorizontalContentAlignment="Center"  Effect="{StaticResource shadowMin}"
								VerticalAlignment="Center" HorizontalAlignment="Center" CheckBoxForeground="#fff"
							Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" IsChecked="{Binding Path=IsChecked}" />

						<TextBlock  Grid.Column="1" Grid.Row="0" Margin="8,5,3,2" FontWeight="Bold" FontSize="14" Foreground="#333"
									Text="{Binding Path=Title}" VerticalAlignment="Center" 
									 SnapsToDevicePixels="true" TextTrimming="CharacterEllipsis" />
						<!--<TextBlock  Grid.Column="1"  Grid.Row="1"  Margin="8,1,3,3"  Foreground="#999" FontSize="11"
									Text="{Binding Path=Po.ClassName}" TextTrimming="CharacterEllipsis" 
									 SnapsToDevicePixels="true" />-->

						<ParseControls:FwCheckBox x:Name="toggleStart" IsChecked="{Binding Path=IsStar}"
								Padding="0" Height="24" Width="24" Grid.Column="1" Margin="0,0,5,0" 
									CheckBoxVisualType="Star" VerticalAlignment="Center"  HorizontalAlignment="Right">
						</ParseControls:FwCheckBox>

					</Grid>
				</DataTemplate>
			</ListView.ItemTemplate>
			<!--<ListView.ItemTemplate>
				<DataTemplate>
					<Grid SnapsToDevicePixels="true"  >
						<Grid.RowDefinitions>
							<RowDefinition Height="*" />
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>

						--><!--<Rectangle Fill="#fff" Grid.ColumnSpan="2" Grid.RowSpan="2" 
								   Effect="{StaticResource shadowDark}" />--><!--

						<Border SnapsToDevicePixels="true" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />

						<Border SnapsToDevicePixels="true" Margin="0,0,3,0" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />

						<ParseControls:FwCheckBox Width="30" Height="30"  SnapsToDevicePixels="true" Margin="10,3,0,3"
							VerticalContentAlignment="Center" HorizontalContentAlignment="Center" 
								VerticalAlignment="Center" HorizontalAlignment="Center" 
							Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" TransportObject="{Binding}" />

						<TextBlock  Grid.Column="1"  Grid.Row="0"  Margin="8,5,3,2" FontWeight="Bold" FontSize="14" Foreground="#333"
									Text="{Binding Path=Title}"
									 SnapsToDevicePixels="true" TextTrimming="CharacterEllipsis" />
						<TextBlock  Grid.Column="1"  Grid.Row="1"  Margin="8,1,3,3"  Foreground="#999" FontSize="11"
									Text="{Binding Path=Po.ClassName}" TextTrimming="CharacterEllipsis" 
									 SnapsToDevicePixels="true" />

					</Grid>
				</DataTemplate>
			</ListView.ItemTemplate>-->
			<ListView.GroupStyle>
				<GroupStyle>
					<GroupStyle.HeaderTemplate>
						<DataTemplate>
								<Grid>
									<Rectangle Fill="#FFCB0F0F" Opacity="0.75" />
									<TextBlock FontWeight="Bold" FontSize="16" Foreground="#FFffffff" 
									   Text="{Binding Name}" Margin="5"/>
								</Grid>
						</DataTemplate>
					</GroupStyle.HeaderTemplate>
					<GroupStyle.ContainerStyle>
						<Style TargetType="{x:Type GroupItem}">
							<Setter Property="Template">
								<Setter.Value>
									<ControlTemplate TargetType="{x:Type GroupItem}">
										<Grid>
											<Grid.RowDefinitions>
												<RowDefinition Height="Auto" />
												<RowDefinition Height="Auto" />
											</Grid.RowDefinitions>

											<ContentPresenter Grid.Row="0" />
											<ItemsPresenter x:Name="itemsPresenterGroup" Grid.Row="1" />
										</Grid>
									</ControlTemplate>
								</Setter.Value>
							</Setter>
						</Style>
					</GroupStyle.ContainerStyle>
				</GroupStyle>
			</ListView.GroupStyle>
		</ListView>


		<!-- Visibility="{Binding Path=DoneItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, 
					Converter={StaticResource ivc}}" -->
		<Border Grid.Row="1" Margin="0,10,0,0" Background="#ff333333" 
				 Visibility="{Binding Path=DoneItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, 
					Converter={StaticResource ivc}}" >
			<TextBlock Text="abgeschlossen" FontWeight="Bold" Foreground="#fff" FontSize="14" Margin="5" />
		</Border>
		<ListView x:Name="listviewDone" Grid.Row="2" SnapsToDevicePixels="true" 
				   Visibility="{Binding Path=DoneItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, 
					Converter={StaticResource ivc}}" 
				  ItemContainerStyle="{StaticResource listboxitem}"
					 Style="{StaticResource viewListView}" Opacity="0.6"
						ItemsSource="{Binding Path=DoneItems, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
									ScrollViewer.HorizontalScrollBarVisibility="Disabled"
									ScrollViewer.VerticalScrollBarVisibility="Auto"
									SelectedItem="{Binding Path=SelectedDoneItem, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}" >
			<ListView.ItemTemplate>
				<DataTemplate>
					<Grid SnapsToDevicePixels="true"  >
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>

						<Rectangle Fill="#FFffffff" Opacity="0.75" Grid.ColumnSpan="2"  />

						<!--<Border SnapsToDevicePixels="true" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />

						<Border SnapsToDevicePixels="true" Margin="0,0,3,0" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />-->

						<ParseControls:FwCheckBox Width="30" Height="30"  SnapsToDevicePixels="true" Margin="10,3,0,3"
							VerticalContentAlignment="Center" HorizontalContentAlignment="Center" 
								VerticalAlignment="Center" HorizontalAlignment="Center" CheckBoxForeground="#999"
							Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" IsChecked="{Binding Path=IsChecked}" />

						<TextBlock  Grid.Column="1" Grid.Row="0" Margin="8,5,3,2" FontWeight="Bold" FontSize="14" Foreground="#333"
									VerticalAlignment="Center"  
									Text="{Binding Path=Title}" SnapsToDevicePixels="true" TextTrimming="CharacterEllipsis" />
					</Grid>
				</DataTemplate>
			</ListView.ItemTemplate>
		</ListView>
	</Grid>
	
</UserControl>
